package com.aspose.cells;

class zawo extends zawk {
   private int f;
   private int g;
   private int h;
   private int i;
   private zp j;
   private zahl k;
   private zfv l = new zfv();
   private int m = -1;

   public zawo(zaay var1, Worksheet var2, zp var3, int var4, int var5) {
      super(var1, var2);
      this.j = var3;
      this.f = var4;
      this.g = var5;
      int var6 = -1;
      int var7 = -1;
      zahl var8 = null;
      int[] var9 = new int[]{-1, -1};
      if (var3.a(this.f, this.g, var9)) {
         this.m = var9[0];
         var8 = this.j.a(this.f, this.m, this.g, var9[1], false);
         boolean var10 = false;
         if (this.j.h(this.m) != 0) {
            this.c = this.j.a(this.m, this.l, 7);
            var6 = this.c.a;
         } else {
            var10 = true;
            var8.a();

            while(true) {
               this.m = var8.a();
               if (this.m < 0) {
                  this.k = null;
                  break;
               }

               if (this.j.h(this.m) != 0) {
                  this.c = this.j.a(this.m, this.l, 7);
                  var6 = this.c.a;
                  var9[0] = this.m;
                  break;
               }
            }
         }

         if (var6 > -1) {
            if (var9[1] > this.m) {
               if (this.j.h(var9[1]) != 0) {
                  var7 = this.j.a(var9[1]);
               } else {
                  var10 = true;
                  zahl var11 = this.j.a(var6, this.m, this.g, var9[1], true);
                  var11.a();

                  do {
                     this.m = var11.a();
                  } while(this.j.h(this.m) == 0);

                  var7 = this.j.a(this.m);
                  var9[1] = this.m;
                  this.m = var9[0];
               }

               if (var10) {
                  if (var6 < var7) {
                     var8 = this.j.a(var6, this.m, var7, var9[1], false);
                  } else {
                     var8 = null;
                  }
               }

               var6 -= this.f;
               var7 -= this.f;
            } else {
               var6 -= this.f;
               var7 = var6;
               var8 = null;
            }
         }
      }

      this.k = var8;
      this.h = var6;
      this.i = var7;
   }

   private zawo(zaay var1, Worksheet var2, zp var3, int var4, int var5, int var6, int var7) {
      super(var1, var2);
      this.j = var3;
      this.f = var4;
      this.g = var5;
      this.h = var6;
      this.i = var7;
      if (var7 > -1) {
         this.k = this.j.b(var4 + var6, var5 + var6, false);
      }

   }

   public zahn b(zaay var1) {
      zawo var2 = new zawo(this.b, this.a, this.j, this.f, this.g, this.h, this.i);
      var2.a(this);
      var2.m = this.m;
      return var2;
   }

   public int c() {
      return 1;
   }

   public int d() {
      return this.g - this.f + 1;
   }

   public int e() {
      return this.d();
   }

   public boolean l() {
      return false;
   }

   public boolean m() {
      return true;
   }

   public boolean n() {
      return false;
   }

   public zfv c(int var1, int var2) {
      if (var2 >= this.h && var2 <= this.i) {
         if (this.h == this.i) {
            return this.c;
         } else {
            this.m = this.j.a(var2 + this.f, this.m);
            if (this.m < 0) {
               this.m = -this.m - 1;
               return null;
            } else {
               return this.j.a(this.m, this.l, this.e);
            }
         }
      } else {
         return null;
      }
   }

   public zagu a(int var1, int var2) {
      if (var2 >= this.h && var2 <= this.i) {
         if (this.h == this.i) {
            if (this.d != null) {
               return this.d;
            } else {
               this.d = this.C();
               return this.d;
            }
         } else {
            this.m = this.j.a(var2 + this.f, this.m);
            if (this.m < 0) {
               this.m = -this.m - 1;
               return zzk.a;
            } else {
               return this.a(this.j.a(this.m, this.l, 4));
            }
         }
      } else {
         return zzk.a;
      }
   }

   public void f() {
      if (this.i > this.h) {
         this.k.b();
      } else if (this.h > -1) {
         this.m = -1;
      }

   }

   public boolean b(int var1, int var2) {
      return this.a(var2);
   }

   public boolean a(int var1) {
      if (this.h < 0) {
         return false;
      } else if (var1 <= this.h) {
         if (this.h < this.i) {
            this.k.b();
            this.c = this.j.a(this.k.a(), this.l, this.e);
            this.d = null;
         }

         return true;
      } else if (var1 > this.i) {
         return false;
      } else {
         this.k.b(var1 + this.f);
         return this.g();
      }
   }

   public boolean g() {
      if (this.h < 0) {
         return false;
      } else if (this.h == this.i) {
         if (this.m > -1) {
            return false;
         } else {
            this.m = 0;
            return true;
         }
      } else {
         int var1 = this.k.a();
         if (var1 < 0) {
            return false;
         } else if (this.j.h(var1) != 0) {
            this.c = this.j.a(var1, this.l, this.e);
            this.d = null;
            return true;
         } else {
            do {
               var1 = this.k.a();
               if (var1 < 0) {
                  return false;
               }
            } while(this.j.h(var1) == 0);

            this.c = this.j.a(var1, this.l, this.e);
            this.d = null;
            return true;
         }
      }
   }

   public int i() {
      return 0;
   }

   public int j() {
      return this.c.a - this.f;
   }

   public int k() {
      return this.c.a - this.f;
   }

   public zahn b(int var1) {
      return this;
   }

   public zahn c(int var1) {
      return new zawm(this.b, this.a, this.c(0, var1));
   }

   public zahn c(zaay var1) {
      if (this.i < 0) {
         return new zawz(zzk.a, 9, 1, this.d());
      } else {
         zagu[] var2;
         if (this.i == this.h) {
            if (this.d == null) {
               this.d = this.C();
            }

            var2 = new zagu[]{this.d};
         } else {
            var2 = new zagu[this.i - this.h + 1];
            com.aspose.cells.a.c.zc.a(var2, 0, var2.length, zzk.a);
            this.k.b();

            while(true) {
               int var3 = this.k.a();
               if (var3 < 0) {
                  if (this.c != null) {
                     this.k.b(this.c.a + 1);
                  }
                  break;
               }

               if (this.j.h(var3) != 0) {
                  zfv var4 = this.j.a(var3, this.l, 5);
                  var2[var4.a - this.f - this.h] = this.a(var4);
               }
            }
         }

         return new zawg(var2, false, -this.h, this.d(), 9, zzk.a, -1, false);
      }
   }

   public boolean q() {
      return true;
   }

   public int r() {
      return this.h < 0 ? -1 : 0;
   }

   public int s() {
      return this.i < 0 ? -1 : 0;
   }

   public int t() {
      return this.h;
   }

   public int u() {
      return this.i;
   }

   public int w() {
      return this.i;
   }

   public int v() {
      return this.h;
   }
}
